package com.mjf.srm.enums;

import cn.hutool.core.collection.ListUtil;
import lombok.Getter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * desc  天发API枚举
 * </p>
 *
 * @author chenshoumeng
 * @date 2025/5/18 02:00
 */
@Getter
public enum SRMApiEnum {

    VENDOR_VERIFY("401", "供应商登录验证", "/openapi/test/js/a/coop/vendor/verify", ListUtil.of(), ""),
    PUR_LIST("402", "采购订单同步", "/openapi/test/js/a/coop/vendor/purList", ListUtil.of(), ""),
    PUR_FIND("403", "获取指定采购订单信息", "/openapi/test/js/a/coop/vendor/purFind", ListUtil.of(), ""),
    SALE_ORDER("404", "销售订单发送", "/openapi/test/js/a/coop/vendor/saleOrder", ListUtil.of(), ""),
    VENDOR_STOCK("405", "供应商库存同步", "/openapi/test/js/a/coop/vendor/vendorStock", ListUtil.of(), ""),
    ;

    private static final Map<String, SRMApiEnum> LOOKUP_MAP = new HashMap<>(4, 1);

    static {
        for (SRMApiEnum cstEnum : SRMApiEnum.values()) {
            LOOKUP_MAP.put(cstEnum.codes, cstEnum);
        }
    }

    SRMApiEnum(String codes, String name, String url, List<String> filedList, String filedString) {
        this.codes = codes;
        this.name = name;
        this.url = url;
        this.filedList = filedList;
        this.filedString = filedString;
    }

    /**
     * -- GETTER --
     *
     * @return 枚举值
     */
    private String codes;
    private String name;
    private String url;
    private List<String> filedList;
    private String filedString;


    /**
     * 根据枚举值获取枚举
     *
     * @param codes codes
     * @return 若枚举值存在，返回对应的枚举，否则返回 null
     */
    public static SRMApiEnum formValue(String codes) {
        return LOOKUP_MAP.get(codes);
    }


}
